// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'
import Client from '@api/base/api/DeviceListApi'

import ComClass from '@api/ComQuery'
import SelectClass from '@api/base/model/DeviceQueryReq'

const CLIENT = CORE.grpcCLIENT(Client)
const COM = [ComClass, 'comQuery']

// ============================== 导出远程接口 ============================== //

export default {
  // —————————————————————————————— 下拉框 —————————————————————————————— //

  async getSelect(selectParam, TIP = `查询${CORE.MAP.REGION}设备`) {
    const DTO = CORE.grpcDTO(SelectClass, selectParam, COM)
    const resp = await CORE.grpc(TIP, CLIENT, 'queryDeviceList', DTO)
    return (resp.content || []).map((item) => ({ ...item, deviceId: item.id }))
  },
}
